﻿

//更新点击数，差评，好评
function updateArticleNum(id, moduleType, cmd)
    {

        $.ajax({
            type: "get",
            dataType: "json",
            data: "time="+(new Date().getTime()),
            url: "/" + id + "/" + moduleType + "/" + cmd,
            error: function (XmlHttpRequest, textStatus, errorThrown) { alert(errorThrown); alert(textStatus); alert(XmlHttpRequest.responseText); },
            success: function (d) {
                switch (d.result) {
                    case '0':
                        alert("提交失败");
                        break;
                    case '1':
                        if (cmd == "upsupport") {
                            var num = 0;
                            num = $("#digg_num").html()
                            num = parseInt(num) + 1;
                            $("#digg_num").html(num);
                            $("#digg_tip").html("推荐成功");
                            $("#diggit").bind("click", function () { void (0); });

                        }
                        else if (cmd == "upagainst") {
                            var num = 0;

                            num = $("#bury_num").html()
                            num = parseInt(num) + 1;
                            $("#bury_num").html(num);
                            $("#digg_tip").html("反对成功");
                            $("#buryit").bind("click", function () { void (0); });
                        }

                        break;

                    case "-1":
                        alert(d.returnval);
                        break;
                }
            }
        });
}
//搜索
function SiteSearch() {
    var t = "", s = "";
    if ($("#keyword").val() == "只输入关键词，全文自动搜索") {
        alert("请填写查询内容");
        return;
    }
    if ($("#keyword").val() != "") {
        s = encodeURIComponent($.trim($("#keyword").val()));
    }
    else {
        alert("请填写查询内容");
        return;
    }
    location.href = "/search/" + s;
}